package top.lemna.code;

import java.util.List;
import org.apache.commons.lang3.StringUtils;
import cn.hutool.core.io.file.FileReader;
import lombok.extern.slf4j.Slf4j;
import top.lemna.code.generate.CommonGenerator;

@Slf4j
public class DubboClassGenerator {


  public static void main(String[] args) {
    String templatePath = args[0];// "src/main/resources/public/dubbo";
    String basePackage = args[1];// "top.lemna.kllm.base"
    String outPath = args[2];// "generate/ccc/"
    String file = args[3];// d:/hu/test.txt


    FileReader fileReader = new FileReader(file);
    List<String> lines = fileReader.readLines();

    try {
      for (String className : lines) {
        className = className.trim();
        if (StringUtils.isEmpty(className)) {
          return;
        }
        System.out.println("-------------------------------------------------------------");
        System.out.println("-----------------------------------------className:" + className);
        log.info("className:{}", className);
        CommonGenerator dubboGenerator =
            new CommonGenerator(className, basePackage, outPath, templatePath);
        dubboGenerator.generator();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    
    
  }


  

}
